﻿using MemoryDuosRankings;
using System;
using System.Windows.Forms;

namespace MemoryDuosInterfaz
{
    public partial class Main : Form
    {
        private Publicidad Publi { get; set; }

        private DAL dal { get; set; }

        public Main()
        {
            InitializeComponent();
            Publi = new Publicidad(pictureBox1);
            dal = DAL.Instance;
        }

        private void bjugar_MouseHover(object sender, EventArgs e)
        {
            // var button = sender as Button;
            // var bname = button.name;
            // ToolTip t1 = new ToolTip();
            // t1.Show(button.Name, bjugar);

            //this.bjugar.Size = new System.Drawing.Size(285, 50);
            //System.Windows.Forms.Button bselect=new ;
            // this.bname.Size = new System.Drawing.Size(285, 150);
        }

        private void jugar_Click(object sender, EventArgs e)
        {
            SeleccionNivel selNivel = new SeleccionNivel();
            if (dal.HayPartidaSinFinalizar())
            {
               //  selNivel.ShowDialog(this);
                selNivel.Owner = this;// selNivel.Show(this);
                var rnk = dal.ObtenerPartidaSinFinalizar();
                selNivel.ContinuarPartida(rnk);
            }
            else
            {
                selNivel.ShowDialog(this);
            }
        }

        private void ranking_Click(object sender, EventArgs e)
        {
            RankingIndividual rank = new RankingIndividual();

            rank.ShowDialog();
        }

        private void salir_Click(object sender, EventArgs e)
        {
            this.Close();
            Application.Exit();
        }

        private void Main_Load(object sender, EventArgs e)
        {
        }

        private void Main_FormClosed(object sender, FormClosedEventArgs e)
        {
            Application.Exit();
        }

        private void breglas_Click(object sender, EventArgs e)
        {
            Reglas reg = new Reglas();
            reg.leerReglas();
            reg.ShowDialog();
        }

        private void pictureBox1_Click(object sender, EventArgs e)
        {
            Publi.cargarEnlaces();
        }
    }
}
